from devtools import debug
from pydantic.v1 import (
    BaseModel,
    Field,
    ValidationError,
)


class People(BaseModel):
    name: str = Field(..., description="姓名", min_length=1, max_length=10)


if __name__ == "__main__":
    try:
        People(name="")

    except ValidationError as e:
        debug(e.errors())
        debug(e.model)

#
#
# from devtools import debug
# from pydantic.v1 import BaseModel, Field
# from utils.validator_utils.pydantic_x.parser import parse_model_fields
#
#
# class Hobby(BaseModel):
#     name: str = Field(..., title="名称", min_length=1, max_length=10)
#     years: int = Field(..., title="持续时长", gt=1, lt=100)
#
#
# class User(BaseModel):
#     name: str = Field(..., title="姓名", min_length=3, max_length=20)
#     hobbies: list[Hobby] = Field(..., title="爱好")
#
#
# dic = {}
# parse_model_fields(User, dic)
# debug(dic)
